﻿package mortal.game.scene3D.ai
{
    import baseEngine.system.*;
    import mortal.game.scene3D.*;
    import mortal.game.scene3D.ai.base.*;
    import mortal.game.scene3D.ai.data.*;
    import mortal.game.view.copy.petBreak.*;

    public class AIFactory extends Object
    {
        private var _aiDataPool:Array;
        private var _aiPool:Array;
        private var _followFightAIDataPool:Array;
        private static var _instance:AIFactory;

        public function AIFactory()
        {
            this._aiDataPool = [];
            this._aiPool = [];
            this._followFightAIDataPool = [];
            return;
        }// end function

        public function inAI(param1:IAICommand) : void
        {
            return;
        }// end function

        public function outAIData() : AIData
        {
            var _loc_2:AIData = null;
            if (this._aiDataPool.length == 0)
            {
                _loc_2 = new AIData();
                _loc_2.scene = Global3D.scene as GameScene3D;
                _loc_2.meRole = PetBreakCopyUtil.player;
                _loc_2.times = 0;
                _loc_2.range = 0;
                return _loc_2;
            }
            var _loc_1:* = this._aiDataPool.shift();
            _loc_1.times = 0;
            _loc_1.range = 0;
            return _loc_1;
        }// end function

        public function inAIData(param1:AIData) : void
        {
            if (param1 is FollowFightAIData)
            {
                this._followFightAIDataPool.push(param1);
            }
            else
            {
                this._aiDataPool.push(param1);
            }
            return;
        }// end function

        public function outFollowFightAIData() : FollowFightAIData
        {
            var _loc_1:FollowFightAIData = null;
            if (this._followFightAIDataPool.length == 0)
            {
                _loc_1 = new FollowFightAIData();
                _loc_1.scene = Global3D.scene as GameScene3D;
                _loc_1.meRole = PetBreakCopyUtil.player;
            }
            else
            {
                _loc_1 = this._followFightAIDataPool.shift();
            }
            _loc_1.times = 0;
            _loc_1.range = 0;
            _loc_1.skillInfo = null;
            _loc_1.point = null;
            _loc_1.entitys = null;
            _loc_1.target = null;
            return _loc_1;
        }// end function

        public function inFollowFightAIData(param1:FollowFightAIData) : void
        {
            this._followFightAIDataPool.push(param1);
            return;
        }// end function

        public static function get instance() : AIFactory
        {
            if (_instance == null)
            {
                _instance = new AIFactory;
            }
            return _instance;
        }// end function

    }
}
